# OPC to Socket Data Sender

This Python script monitors data from an OPC server and periodically sends it over a UDP socket. It handles reconnection in case of connection loss and logs events.

## Requirements
- Python 3.x
- OpenOPC library

## Setup

1. Install Python 3.x from the [official website](https://www.python.org/downloads/).
2. Install the OpenOPC library by running `pip install Pyro4`.
3. Update the `log_file_path` variable with the desired log file path.
4. Modify the `addr` variable to the appropriate socket host and port.
5. Run the script using `python your_script_name.py`.

## Configuration

- `max_retries`: Maximum number of connection retry attempts before exiting the script.
- `log_file_path`: Path to the log file where events will be logged.
- `addr`: Tuple containing the socket address (host, port) to which the data will be sent.

## Usage

1. Run the script using `python your_script_name.py`.
2. The script will attempt to connect to the OPC server and the socket. If the connections fail, it will retry according to the specified number of maximum retries.
3. Once connected, it will retrieve data from the OPC server and send it over the socket.
4. Successful events and errors will be logged in the specified log file.

Feel free to customize the script according to your specific needs.
